package com.nbgs.demo.controller;

import com.nbgs.demo.common.Result;
import com.nbgs.demo.controller.form.UpdateForm;
import com.nbgs.demo.service.UpdateConsumptionInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@CrossOrigin("*")
@Api(tags = "修改用水信息的功能", description = "根据表单里面传过来的的信息进行修改")
public class UpdateConsumptionInfoController {

    @Autowired
    private UpdateConsumptionInfoService updateInfo;

    @PutMapping("updateConsumptionEndInfo")
    @ApiOperation("修改指定用户的用水信息以及账单价格")
    private Result updateInfo(@RequestBody UpdateForm updateForm){

        log.info("当前参数："+updateForm);
        updateInfo.updateConsumptionInfo(updateForm.getConsumptionId(),updateForm.getConsumptionEnd(),updateForm.getConsumptionStart(),updateForm.getType());

        return Result.success();
    }



}
